import request from '@/utils/request'

export function getSalesData() {
  return request({
    url: '/sale/sale/statisTotal',
    method: 'get'
  });
}
export function getAllOrder() {
  return request({
    url: '/sale/sale/statisAllOrder',
    method: 'get'
  });
}
export function getSaleTotal() {
  return request({
    url: '/sale/sale/statisTpriASCtime',
    method: 'get'
  });
}
// 查询商品销售列表
export function listSale(query) {
  return request({
    url: '/sale/sale/list',
    method: 'get',
    params: query
  })
}

// 查询商品销售详细
export function getSale(id) {
  return request({
    url: '/sale/sale/' + id,
    method: 'get'
  })
}

// 新增商品销售
export function addSale(data) {
  return request({
    url: '/sale/sale',
    method: 'post',
    data: data
  })
}

// 修改商品销售
export function updateSale(data) {
  return request({
    url: '/sale/sale',
    method: 'put',
    data: data
  })
}

// 删除商品销售
export function delSale(id) {
  return request({
    url: '/sale/sale/' + id,
    method: 'delete'
  })
}
export function getTodayOrderCount() {
  return request({
    url: '/sale/sale/statisOrder',
    method: 'get'
  });
}

// 获取今日销售额
export function getTodaySalesAmount() {
  return request({
    url: '/sale/sale/statisTotalPrice',
    method: 'get'
  });
}
